import React, { useState } from "react"
import { Button, Form, Input, TimePicker } from 'antd'
import "./"
import moment from 'moment'
import { Switch } from 'antd';
import "./index.css"
//引入上传图片插件
import Pictures from "../../../../../component/Pictures"
const Setting = (props) => {
    const [value, setValue] = useState("00:00:00");
    const [valuess, setValues] = useState("00:00:00");
    // const [collapsed, toggleCollapsed] = useState()
    const onFinish = (values) => {
        //values为提交的内容
        console.log('Success:', values);
        //延时器
        setTimeout(() => {
            alert("提交成功")
            props.history.push("/home/commander/ckeckAmdin")
        }, 800)

    };
    const options = [
        { label: '快递', value: '快递' },
        { label: '自提', value: '自提' },
        { label: '团长配送', value: '团长配送' },
    ];
    function onChanges(checkedValues) {
        console.log('checked = ', checkedValues);
    }
    function onChang(time, timeString) {
        console.log(111)
        //  console.log(timeString)
        /* const a=time._d
        const a=JSON.parse(JSON.stringify(timeString))*/
        setTimeout(() => {
            setValue(timeString);
            console.log(value)
        }, 0)
    };
    function onChan(time, timeString) {
        console.log(timeString)
        /*const a=time._d
       const ss=  tnum(a)
       console.log(ss)*/
        setValues(timeString);
        console.log(valuess)
    };
    const handling = (e) => {
        console.log(e.response)
    }
    return <div className='setting'>
        <div className="three">
            <Form onFinish={onFinish}>
                <Form.Item className="f1" label="开启社区团购" valuePropName="checked">
                    <Switch />
                </Form.Item>
                <Form.Item
                    className="f2"
                    label="公告"
                    name="username"
                    rules={[
                        {
                            required: true,
                            message: 'Please input your username!',
                        },
                    ]}
                >
                    <Input placeholder="今日秒杀" />
                </Form.Item>
                <Form.Item className="f" label="休市时间">
                    <TimePicker onChange={onChang} value={moment(value, 'HH:mm:ss')} />
                    <TimePicker onChange={onChan} value={moment(valuess, 'HH:mm:ss')} />
                </Form.Item>
                <Form.Item className="f4" label="团长申请海报">
                    <Pictures content={handling} ></Pictures>
                </Form.Item>
                <Form.Item
                    className="f5"
                    label="自定义团长名称"
                    name="mingchneg1"
                    rules={[
                        {
                            required: true,
                            message: 'Please input your username!',
                        },
                    ]}
                >
                    <Input placeholder="团长" />
                </Form.Item>
                <Form.Item
                    className="f5"
                    label="团长覆盖范围"
                    name="fanwei"
                    rules={[
                        {
                            required: true,
                            message: 'Please input your username!',
                        },
                    ]}
                >
                    <Input placeholder="99.999999" />
                </Form.Item>
                <Form.Item
                    className="f1"
                    label="提现手续费"
                    name="shouxv"
                    rules={[
                        {
                            required: true,
                            message: 'Please input your username!',
                        },
                    ]}
                >
                    <Input placeholder="0.00" />
                </Form.Item>
                <Form.Item
                    className="f6"
                    label="最低提现金额"
                    name="jine"
                    rules={[
                        {
                            required: true,
                            message: 'Please input your username!',
                        },
                    ]}
                >
                    <Input placeholder="0.00" />
                </Form.Item>
                <Form.Item
                    className="f7"
                    label="团长佣金"
                    name="moneu"
                    rules={[
                        {
                            required: true,
                            message: 'Please input your username!',
                        },
                    ]}
                >
                    <Input placeholder="0.00" />
                </Form.Item>
                <Form.Item
                    className="f2"
                    wrapperCol={{
                        offset: 8,
                        span: 16,
                    }}
                >
                    <Button type="primary" htmlType="submit">
                        提交
                    </Button>
                </Form.Item>
            </Form>
        </div>

    </div>
}
export default Setting;
